
import TableList from "../../templates/tablelist";
import { 
    HttpGetAnnouncement,
} from '../../../service/homepage'
import compContent from './content'
import { mapState,mapGetters } from "vuex";
export default {
    mixins: [TableList],
    components:{
        compContent
    },
    data() {
        return {
            // totals: 0,
            isMixin: true,
            Tools: {show: true},
            Tabs: {show: true},
            formData:{
                sidx:'weight,created,id',
                "search[EQ_active]":'Y',
            },
            Searchs: {
                show: true,
                labelWidth: 90,
            },
            Plugins: {show: true},
        }
    },
    methods: {
        ajaxRequest: HttpGetAnnouncement,
        // 全部按钮点击操作
        handleOperate(params="", type,batch) {
            switch (type) {
                case 'content':
                    this.operate = {
                        title: '取消订单',
                        show:true,
                        width:900,
                        component: "compContent",
                        itemId:params,
                        showFooter:false,
                    }
                    break;
                
            }
        },
    },
    computed: {
        ...mapState('boss', ['accounts','countries','products','accountTypes']),
        ...mapGetters('boss', ['accountTypeList']),
        accountsAll(){
            return this.accounts.sort(function(a,b){
                return a.flag.localeCompare(b.flag)
            })
        },
        // table中单据状态的按钮展示
        orderStatus(){
            return [
                {
                    value: '0',
                    label: '有效',
                    theme:'info',
                },
                {
                    value: '1',
                    label: '失效',
                    theme:'error',
                }, 
            ];
        },
        // 搜索下拉框展示内容
        SearchsData() {
            return  [
                {
                    label: "标题",
                    tag:'Input',
                    key: 'CN_title',
                    show:true,
                },
                
            ]
        },
        // table的展示数据
        columns() {
            return  [{
                type: 'selection',
                width: 40,
                align: 'center',
                formName: 'id'
            },
            {
                title: '标题',
                key: 'title',
                render:(h,{row})=> {
                    return <div>
                        <a onClick={this.handleOperate.bind(this, row.id, 'content')}>{row.title}</a>
                    </div>
                },
            },{
                title: '创建时间',
                key: 'created',
                sortable: true
            },
            {
                title: '更新时间',
                key: 'updated',
                sortable: true
            },
        ];
        },
        
    },

};
